<?php
define("JL", 1);

@session_start();
// Includes obligatorios
include ('./dbconfig.php');

/**
 * Mail to contact
 */
if (isset($_POST['_txtvalido']) && !empty($_POST['_txtvalido'])) {
    include( './administration/Libraries/Tools/JLTools.class.php' );

    $remitente = "CSME Back Office <system@csme.fr>";
    $asunto = "Formulaire de contact CSME - " . $_POST['_section_name'];
    $seccion_name = '<EM>Section: <strong>' . $_POST['_section_name'] . '</strong></EM>';

    $_genero = trim($_POST['_genero']);
    $_txtnom = trim($_POST['_txtnom']);
    $_txtprenom = trim($_POST['_txtprenom']);
    $_txtcodepostal = trim($_POST['_txtcodepostal']);
    $_txtville = trim($_POST['_txtville']);
    $_txtemail = trim($_POST['_txtemail']);

    $_txtmessage = str_replace("\n", "<br />", trim($_POST['_txtmessage']));
    $_txtmessage = str_replace("'", "&rsquo;", trim($_txtmessage));
    $_txtmessage = str_replace(trim("\ "), "", trim($_txtmessage));

    $nombrefull = $_genero . " " . $_txtnom . " " . strtoupper($_txtprenom);
    $nombre = $_txtnom . " " . strtoupper($_txtprenom);
    if (!empty($_txtcodepostal))
        $_txtcodepostal = ", " . $_txtcodepostal;

    $ville = $_txtville . $_txtcodepostal;
    $email = $_txtemail;

    $SQL = "SELECT 
          `int_id_template`,
          `var_title_template`,
          `txt_template_html`,
          `int_id_state`
        FROM 
          `tbl_template`
        WHERE
          `int_id_template` = '1'";

    $res = mysql_query($SQL, $cnn);
    $row = mysql_fetch_assoc($res);
    $message = $row['txt_template_html'];

    $jl = JLTools::getInstance();
    $_month = array("Janvier", "F&eacute;vrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao&ucirc;t", "Septembre", "Octobre", "Novembre", "D&eacute;cembre");
    $_days = array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche");
    $_year = date("Y");
    $fecha = "le " . $_days[intval(date("N")) - 1] . " " . date("j") . " " . $_month[intval(date("n")) - 1] . " " . $_year;

    $_section = trim($_POST['_section']);
    $SQL = "SELECT 
          tbl_users.var_fullname,
          tbl_users.var_email
        FROM
          tbl_states
          INNER JOIN tbl_users ON (tbl_states.int_id_state = tbl_users.int_id_state)
        WHERE
          tbl_users.int_id_section = '" . $_section . "' AND tbl_users.int_id_state <> 3";

    $res = mysql_query($SQL, $cnn);


    require "./administration/Libraries/Tools/phpmailer/phpmailer.php";
    $mail = new PHPMailer();

    $mail->PluginDir = "";
    $mail->IsHTML(true);
    $mail->CharSet = "utf-8";
    $mail->IsMail();
    $mail->Timeout = 10;
    $mail->From = "system@csme.fr";
    $mail->FromName = utf8_encode("CSME Back Office");
    $mail->Subject = $asunto;

    if (mysql_num_rows($res) > 0) {
        $severPath = getNameDomain();
        $message = str_replace("%SERVER%", $severPath, $message);
        $message = str_replace("%FECHA%", $fecha, $message);
        $message = str_replace("%SECCION%", $seccion_name, $message);
        $message = str_replace("%NOMBREFULL%", $nombrefull, $message);
        $message = str_replace("%DIRECCION%", $ville, $message);
        $message = str_replace("%MAIL%", $email, $message);
        $message = str_replace("%NOMBRE%", $nombre, $message);
        $message = str_replace("%MENSAJE%", $_txtmessage, $message);
        $mail->Body = $message;

        while ($row = mysql_fetch_assoc($res)) {

            $mails = explode(",", $row['var_email']);

            if (count($mails) > 0) {
                foreach ($mails as $v) {
                    $mail->AddAddress($row['var_fullname'] . " <" . $v . ">");
                    $exito = $mail->Send();
                    $mail->ClearAddresses();
                }
            } else {
                $mail->AddAddress($row['var_fullname'] . " <" . $row['var_email'] . ">");
                $exito = $mail->Send();
                $mail->ClearAddresses();
            }
        }
    } else {
        $SQL = "SELECT 
              tbl_users.var_fullname,
              tbl_users.var_email
            FROM
              tbl_states
              INNER JOIN tbl_users ON (tbl_states.int_id_state = tbl_users.int_id_state)
            WHERE
              tbl_users.int_id_typeuser = 1 AND tbl_users.int_id_state <> 3";

        $res = mysql_query($SQL, $cnn);

        $severPath = getNameDomain();
        $message = str_replace("%SERVER%", $severPath, $message);
        $message = str_replace("%FECHA%", $fecha, $message);
        $message = str_replace("%SECCION%", $seccion_name, $message);
        $message = str_replace("%NOMBREFULL%", $nombrefull, $message);
        $message = str_replace("%DIRECCION%", $ville, $message);
        $message = str_replace("%MAIL%", $email, $message);
        $message = str_replace("%NOMBRE%", $nombre, $message);
        $message = str_replace("%MENSAJE%", $_txtmessage, $message);

        while ($row = mysql_fetch_assoc($res)) {
            $mail->Body = $message;
            $mails = explode(",", $row['var_email']);

            if (count($mails) > 0) {
                foreach ($mails as $v) {
                    $mail->AddAddress($row['var_fullname'] . " <" . $v . ">");
                    $exito = $mail->Send();
                    $mail->ClearAddresses();
                }
            } else {
                $mail->AddAddress($row['var_fullname'] . " <" . $row['var_email'] . ">");
                $exito = $mail->Send();
                $mail->ClearAddresses();
            }
        }
    }

    @mysql_close($cnn);
    echo $message;
    exit();
}// End Contacts

$select = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);

if (empty($select)) {
    $select = 1;
}

$newId = intval($select) + (2);
define("ID_SECTION", $newId);

$SQL = "SELECT 
	  `int_id_section`,
	  `var_desc_section`,
	  `var_var_file_map`,
	  `int_id_sections_view`
	FROM 
	  `tbl_sections` 
	WHERE `int_id_section` = '" . $newId . "'
	LIMIT 0,1 ";

$res = mysql_query($SQL, $cnn);
$row = mysql_fetch_assoc($res);
$SECCION = $row['var_desc_section'];
$FILE_MAP = $row['var_var_file_map'];
$ip = getIpAddress();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-FR" lang="fr-FR" >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="pragma" content="no-cache" />
        <meta name="robots" content="index, follow" />
        <meta name="google-site-verification" content="l6Fc4-_RGKeL_0Y8H7wAhDHge8ORqjoSkWeN2WQQzrU" />
        <meta name="generator" content="LBN | Design &amp; Development Studio" />
        <title><?php echo $SECCION; ?></title>

        <link href="js/lib/flexslider.css" rel="stylesheet" type="text/css" media="screen, projection" />
        <link href="base.css" rel="stylesheet" type="text/css" media="all" />
        <link href="slider/stylesheets/slider-popup.css" rel="stylesheet" type="text/css" media="screen, projection" />
        <link href="js/lib/xpopup/xpopup-1.0.css" rel="stylesheet" type="text/css" media="screen, projection" />
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script>!window.jQuery && document.write(unescape('%3Cscript src="js/lib/jquery-1.7.1.min.js"%3E%3C/script%3E'))</script>
        <link rel="stylesheet" href="slider/stylesheets/coda-slider-2.0.css" type="text/css" media="screen" />
        <script type="text/javascript" src="slider/javascripts/jquery.coda-slider-2.0_update.js"></script>
        <script type="text/javascript" src="slider/javascripts/jquery.easing.1.3.js"></script>
        <script type="text/javascript" src="js/lib/xpopup/xpopup.min-1.0.js"></script>
        <script type="text/javascript" src="js/lib/jquery.xvalidator-1.0.min.js"></script>
        <script type="text/javascript" src="js/lib/jquery.cookie.min.js"></script>
        <script type="text/javascript" src="js/lib/utils-1.0.min.js"></script>
        <script type="text/javascript" src="js/lib/jquery.tooltip.min.js"></script>
        <script type="text/javascript" src="js/lib/jquery.flexslider-min.js"></script>
        <script type="text/javascript" src="administration/?act=required"></script>
        <script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false"></script>
        <script type="text/javascript" src="js/lib/jquery.gmap3-3.4.min.js"></script>
        <style type="text/css">
            .block { display: inline; }
            #error_chk{ display: none;  color:#C00; }
            label.error{font-size:15px; font-weight:bold; color:#C00; display:inline; }
            #msg-error{ font-weight:bold; color:#C00; }

            .coda-nav ul li.tab2 a,
            .coda-nav ul li.tab3 a{ padding-left: 15px; }
            
            .coda-nav ul li.tab2 a.current,
            .coda-nav ul li.tab3 a.current{ padding-left: 15px; }

            /* Presentation */
            .coda-nav ul li a.submenu{ padding-left: 15px; background-position:20px -10px; }
            .coda-nav ul li a.submenu.current{ padding-left: 15px; background-position:20px 12px; }

            .coda-nav ul li#lim-acess{ display:none; }
            .coda-nav ul li#lim-acess a{ padding-left: 15px; background-position:20px -10px; }
            .coda-nav ul li#lim-acess a.current{ padding-left: 15px; background-position:20px 12px; }

            #lim-photos a{ padding-left: 6px; }
        </style>
        <!--[if IE]>
        <style>.submitimagehidden{ margin-left:160px; margin-top:43px; }</style>
        <![endif]-->
        <!--[if IE 7]>
        <link href="base-ie7.css" rel="stylesheet" type="text/css" media="screen, projection" charset="utf-8" />
        <![endif]-->
        <link rel="shortcut icon" href="favicon.ico" />
        <link rel="alternate" type="application/rss+xml" title="CSME Actualitès - RSS Feed" href="http://feed.csme.fr/" />
    </head>
    <body>
        
        <?php include 'modules/annonce.html.php'; ?>
        
        <div id="button_top">
            <a href="javascript:;"><img src="images/arrow_top.png" width="18" height="25" />
                <span id="top">TOP <br /><strong>SITE</strong></span></a>
        </div>

        <div id="main-container">

            <input id="hdn-section" type="hidden" value="<?php
echo $newId;
?>" />
            <input id="hdn-section_name" type="hidden" value="<?php
                   echo $row['var_desc_section'];
?>" />

            <!-- BN-TOP -->
            <div id="bn-top" class="bxshd">    

                <!-- MENU-TOP -->
                <div class="menu-top">

                    <div id="logo">
                        <a href="./" title="CSME Club Sportif Multisections d'Epinay-sur-Seine"><img alt="CSME LOGO" src="images/csme-logo.png" width="174" height="159" /></a>
                    </div>

                    <!-- NEWSLETTER -->
                    <div id="newsletter" class="bxshd">
                        <div class="newscenter">
                            <div class="newscontent">
                                <h3><img src="images/sobre.png" width="16" height="12" /> Newsletter</h3>
                                <div class="subtitle">Inscrivez-vous à notre newsletter.</div>
                                <div><form action="./" method="post" enctype="application/x-www-form-urlencoded" name="frmnewsletter" id="frmnewsletter">
                                        <input name="txtnom" type="text" class="txtnewsletter" id="txtnom" autocomplete="off" />
                                        <label id="email">
                                            <input name="txtemail" type="text" class="txtnewsletter" id="txtemail" autocomplete="off" />
                                            <input class="valid" type="submit" value="OK" onfocus="this.blur();" />
                                        </label>
                                    </form>
                                </div>



                                <div id="partenaires">

                                    <div class="face_fb_plugin"><a title="Suivez-nous sur facebook" target="_blank" href="http://www.facebook.com/CSMEpinaysurSeine"></a></div>
                                    <div class="text_fb_plugin">Soyez le premier parmi vos amis.
                                        <br />Rejoignez-nous vite !
                                    </div>
                                    <div class="fb_like_plugin">
                                        <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FCSME-Club-Sportif-Multisections-dEpinay-sur-Seine%2F176399182395742&amp;layout=button_count&amp;locale=fr_FR&amp;show_faces=false&amp;width=170&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:170px; height:21px;" allowTransparency="true"></iframe>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- END NEWSLETTER -->


                    <!-- MENU -->
                    <ul>
                        <li><a class="link" title="Accueil" href="./"  target="_parent">Accueil</a></li>
                        <li><a class="link" title="Présentation" href="presentation.html"  target="_parent">Présentation</a></li>
                        <li><a class="link selected" title="Les sections" target="_parent" id="les_sections_id">Les sections</a>
                            <?php
                            include_once 'modules/menu.html.php';
                            printMenu($select);
                            ?>
                        </li>
                        <li><a class="link" title="Actualités" href="actualites.html" target="_parent">Actu. CSME</a></li>
                        <li><a class="link" title="Administration" href="administration.html" target="_parent">Administration</a></li>
                        <li><a class="link" title="Contact" href="contacts.html" target="_parent">Contact</a></li>
                    </ul>
                    <!-- END MENU-->


                </div>
                <!-- END MENU-TOP -->


            </div>
            <!-- END BN-TOP -->


            <!-- BN-CONTENT-->
            <div id="bn-content">

                <!-- BN CONTENT TEXT -->
                <div class="bn-content-text bxshd">
                    <table border="0" cellpadding="0" cellspacing="0" class="bn-ct-repeat">
                        <tr>
                            <td class="bn-ct-r-center">
                                <div id="sections-nav" class="bn-ct-r-center-menu">
                                    <div class="bn-menu-title">
                                        <div class="bn-menu-icon"></div>
                                        <h1 title="<?php echo $row['var_desc_section']; ?>"><?php echo $row['var_desc_section']; ?></h1>
                                    </div>
                                </div>

                                <?php
                                $SQL = "SELECT 
                      `int_id_sections_view`,
                      `txt_desc_presentation`,
                      `txt_desc_adhesion`
                    FROM 
                      `tbl_sections_view`
                    WHERE `int_id_sections_view` = '" . $row['int_id_sections_view'] . "' ";

                                $res = mysql_query($SQL, $cnn);

                                while ($row2 = mysql_fetch_assoc($res)) {
                                    ?>                

                                    <div id="sections-slider" class="coda-slider preload">

                                        <div class="panel">
                                            <div class="panel-wrapper">
                                                <h2 class="title" id="m-presentation">Présentation<div class="sub-line title"></div></h2>
                                                <p class="section">
                                                    <?php echo $row2['txt_desc_presentation']; ?>
                                                </p>
                                            </div>
                                        </div>

                                        <div class="panel">
                                            <div class="panel-wrapper">
                                                <h2 class="title" id="m-membresdubureau">Membres de bureau<div class="sub-line title"></div></h2>
                                                <p>

                                                    <?php
                                                    $SQL = "SELECT 
                                                    `int_id_membres`,
                                                    `var_photo`,
                                                    `var_noms`,
                                                    `var_status`,
                                                    `var_dates`,
                                                    `int_mem_order`,
                                                    `int_id_sections_view`
                                                    FROM 
                                                    `tbl_membres`
                                                    WHERE `int_id_sections_view` = '" . $row['int_id_sections_view'] . "' 
                                                    ORDER BY int_id_membres ASC ";

                                                    $res2 = mysql_query($SQL, $cnn);

                                                    while ($row3 = mysql_fetch_assoc($res2)) {
                                                        ?>
                                                        <table align="left" class="membre-panel" border="0" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td align="left" valign="bottom" class="m-imagen">
                                                                    <img width="130" src="./images/membres/<?php echo $row3['var_photo']; ?>" />
                                                                </td>
                                                                <td class="m-texto" align="left" valign="bottom">

                                                                    <strong style="font-weight:bold;"><?php echo $row3['var_noms']; ?></strong><br />

                                                                    <em style="font-style:italic;"><?php echo $row3['var_status']; ?><br />

                                                                        <?php echo $row3['var_dates']; ?></em>

                                                                </td>
                                                            </tr>
                                                        </table>

                                                    <?php } ?>

                                                </p>
                                            </div>
                                        </div>

                                        <div class="panel">
                                            <div class="panel-wrapper">
                                                <h2 class="title" id="m-adhesion">Adhésion <div class="sub-line title"></div></h2>
                                                <p class="section"><?php echo $row2['txt_desc_adhesion']; ?>
                                                </p>
                                                <p>
                                                    <ul id="section-links-pdf">
                                                        <?php
                                                        $SQL = "SELECT 
                                      `int_id_adhesion`,
                                      `var_title_link`,
                                      `var_link_pdfword`,
                                      `int_id_sections_view`,
                                      `int_id_state`
                                    FROM 
                                      `tbl_adhesion`
                                    WHERE `int_id_sections_view` = '" . $row['int_id_sections_view'] . "' AND `int_id_state` <> 3";
                                                        // echo $row['int_id_sections_view'];
                                                        $res4 = mysql_query($SQL, $cnn);

                                                        while ($row4 = mysql_fetch_assoc($res4)) {
                                                            ?>

                                                            <li class="section-link-pdf"><a href="<?php echo $row4['var_link_pdfword']; ?>" target="_blank"><?php echo $row4['var_title_link']; ?></a></li>

                                                        <?php } ?>
                                                    </ul>
                                                </p>
                                            </div>
                                        </div>

                                        <div class="panel">
                                            <div class="panel-wrapper">
                                                <h2 class="title" id="m-photos">Photos <div class="sub-line title"></div></h2>

                                            </div>
                                        </div>


                                        <?php
                                        $SQL = "SELECT 
                              `int_id_gallery`,
                              `var_title_gallery`,
                              `int_num_photos`,
                              `var_path_gallery`,
                              `int_id_sections_view`
                            FROM 
                              `tbl_gallery`
                            WHERE `int_id_sections_view` = '" . $row['int_id_sections_view'] . "' AND `int_id_state` <> 3 AND `bol_admin` = 0 AND `int_num_photos` > 0
                            ORDER BY `int_id_gallery` DESC";

                                        $res7 = mysql_query($SQL, $cnn);
                                        $num_galleries = mysql_num_rows($res7);
//
//                                        $_fisrt = "";
//                                        $_i = 0;
                                        while ($row7 = mysql_fetch_assoc($res7)) {
//                                            if ($_i == 0)
//                                                $_fisrt = "first-galerie";
//                                            else
//                                                $_fisrt = "first-galerie" . $row7['int_id_gallery'];
//                                            
                                            ?>
                                            <div class="panel">
                                                <div class="panel-wrapper">
                                                    <h2 class="title" id="album-<?php echo $row7['int_id_gallery']; ?>"><?php echo $row7['var_title_gallery']; ?> <div class="sub-line title"></div></h2>
                                                    <iframe src="galerie.php?id=<?php echo $row7['int_id_gallery']; ?>&path=<?php echo $row7['var_path_gallery']; ?>" frameborder="0" scrolling="no" allowTransparency="true" style="width:720px; height:515px;"></iframe>
                                                </div>
                                            </div>
                                            <?php
                                            //// $_i++;
                                        }
                                        ?>

                                        <div class="panel">
                                            <div class="panel-wrapper">
                                                <h2 class="title" id="m-actualites">Actualités <div class="sub-line title"></div></h2>
                                                <p>

                                                    <?php
                                                    $SQL = "SELECT 
                                                        tbl_actualites.int_actualite,
                                                        tbl_actualites.var_ac_title,
                                                        tbl_actualites.txt_content_actualite,
                                                        tbl_actualites.dat_creation_act,
                                                        tbl_actualites.dat_modification_act,
                                                        tbl_actualites.var_monthyear,
                                                        tbl_actualites.int_id_user,
                                                        tbl_actualites.int_id_section,
                                                        tbl_actualites.int_id_state,
                                                        tbl_actualites.int_vote,
                                                        tbl_actualites.txt_image_galleries,
                                                        tbl_sections.var_desc_section
                                                    FROM
                                                        tbl_sections
                                                    INNER JOIN tbl_actualites ON (tbl_sections.int_id_section = tbl_actualites.int_id_section)
                                                    WHERE tbl_actualites.int_id_section = " . ID_SECTION . " OR tbl_actualites.int_id_section = 1
                                                     AND tbl_actualites.int_id_state <> 3
                                                    ORDER BY int_actualite DESC
                                                    LIMIT 500";

                                                    $ress = mysql_query($SQL);
                                                    $t = mysql_num_rows($ress);
                                                    $i = 1;
                                                    while ($row3 = mysql_fetch_assoc($ress)) :
                                                        $idactualite = $row3['int_actualite'];
                                                        ?>
                                                        <p class="sub-title" id="act<?php echo $idactualite; ?>" name="act<?php echo $idactualite; ?>">

                                                            <span class="vote">                    
                                                                <?php
                                                                $sql = "SELECT 
                                                                    chr_ip
                                                                FROM
                                                                    tbl_visiteur
                                                                WHERE
                                                                    int_actualite = " . $idactualite . " AND chr_ip = '" . $ip . "'";

                                                                $resvote = mysql_query($sql);
                                                                if (mysql_num_rows($resvote) == 0) {
                                                                    ?>
                                                                    <span class="icon" xval="<?php echo $idactualite; ?>">J'aime !</span>
                                                                <?php } ?>
                                                                <span class="count"><strong><?php echo $row3['int_vote']; ?></strong></span>
                                                            </span>

                                                            <?php echo $row3['dat_creation_act']; ?></p>
                                                        <p class="sub-title2">Section: <strong style="font-weight:bold;"><?php echo $row3['var_desc_section']; ?></strong></p>
                                                        <p class="title-act"><strong style="font-weight:bold;"><?php echo $row3['var_ac_title']; ?></strong></p>
                                                        <div class="sub-content"><?php echo $row3['txt_content_actualite']; ?></div>

                                                        <?php
                                                        $galleries = $row3['txt_image_galleries'];

                                                        if (!empty($galleries)):
                                                            $galleries = unserialize($galleries);
                                                            if (is_array($galleries)) :
                                                                ?>
                                                                <div class="actualite-galleries">
                                                                    <?php
                                                                    foreach ($galleries as $id) :
                                                                        $sql = "SELECT 
                                                                            tbl_gallery.var_title_gallery,
                                                                            tbl_gallery.var_image_reference,
                                                                            tbl_gallery.bol_admin,
                                                                            tbl_gallery.int_viewed,
                                                                            tbl_sections.int_id_section
                                                                        FROM tbl_sections
                                                                        INNER JOIN tbl_gallery ON (tbl_sections.int_id_sections_view = tbl_gallery.int_id_sections_view)
                                                                        WHERE int_id_gallery = $id
                                                                        LIMIT 1";
                                                                        $resg = mysql_query($sql);
                                                                        $rowg = mysql_fetch_assoc($resg);
                                                                        $title = $rowg['var_title_gallery'];
                                                                        if (str_word_count($title) > 1):
                                                                            $parts = explode(' ', $title);
                                                                            $title = str_replace($parts[1], $parts[1] . '<br />', $title);
                                                                        endif;

                                                                        if ($rowg['bol_admin'] == 1):
                                                                            ?>
                                                                            <a href="administration.html?album=<?php echo $id; ?>">
                                                                                <div class="photo-actu">
                                                                                    <div class="detail">
                                                                                        <h3><?php echo $title; ?></h3>
                                                                                        <strong>Vu<br /><span><?php echo $rowg['int_viewed']; ?></span> fois</strong>
                                                                                    </div>
                                                                                    <span class="background"></span>
                                                                                    <img src="galeries/gallery-reference/<?php echo $rowg['var_image_reference']; ?>" width="218" height="136" />
                                                                                </div>
                                                                            </a>
                                                                            <?php
                                                                        else :
                                                                            $id_section = $rowg['int_id_section'] - 2;
                                                                            ?>
                                                                            <a href="section.html?id=<?php echo $id_section; ?>&amp;album=<?php echo $id; ?>">
                                                                                <div class="photo-actu">
                                                                                    <div class="detail">
                                                                                        <h3><?php echo $title; ?></h3>
                                                                                        <strong>Vu<br /><span><?php echo $rowg['int_viewed']; ?></span> fois</strong>
                                                                                    </div>
                                                                                    <span class="background"></span>
                                                                                    <img src="galeries/gallery-reference/<?php echo $rowg['var_image_reference']; ?>" width="218" height="136" />
                                                                                </div>
                                                                            </a>
                                                                        <?php
                                                                        endif;
                                                                        $i++;
                                                                    endforeach;
                                                                    ?>
                                                                </div>
                                                                <?php
                                                            endif;
                                                        endif;
                                                        ?>
                                                        <div class="sub-line"></div>
                                                        <?php
                                                        $i++;
                                                    endwhile;
                                                    ?>
                                            </div>
                                        </div>

                                        <div class="panel">
                                            <div class="panel-wrapper">
                                                <h2 class="title" id="m-contacts">Contacts <div class="sub-line title"></div></h2>
                                                <div class="bn-contact">

                                                    <form class="cmxform" id="frm-contact" name="frm-contact" method="post" action="?" enctype="application/x-www-form-urlencoded">
                                                        <table class="bn-c-form" border="0" cellspacing="0" cellpadding="0">
                                                            <tr>
                                                                <td align="center" valign="top" colspan="3" height="25"><strong id="msg-error"></strong></td>
                                                            </tr>
                                                            <tr>
                                                                <td width="166" align="right" valign="middle">* Civilité:</td>
                                                                <td width="20"><input type="hidden" id="txtvalido" /></td>
                                                                <td width="324">
                                                                    <label>
                                                                        <input type="radio" value="Mlle." name="gender" id="rdo_mlle" validate="required:true" /> 
                                                                        Mlle </label>
                                                                    <label>
                                                                        <input type="radio" value="Mme." name="gender" id="rdo_mme" /> 
                                                                        Mme </label>
                                                                    <label>
                                                                        <input type="radio" value="M." name="gender" id="rdo_m" /> 
                                                                        M.&nbsp;<label id="error_chk" for="gender" class="error">*</label>
                                                                    </label>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right"></td>
                                                                <td width="20">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right" valign="middle">* Nom :</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td><input name="txtnom" type="text" class="text" id="txtnom2" value=""  /></td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right">&nbsp;</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right" valign="middle">* Prénom :</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td><input name="txtprenom" type="text" class="text" id="txtprenom" value="" />
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right">&nbsp;</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right" valign="middle">Code Postal :</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td><input name="txtcodepostal" type="text" class="text" id="txtcodepostal" value="" /></td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right">&nbsp;</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right" valign="middle">Ville :</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td><input name="txtville" type="text" class="text" id="txtville" value="" /></td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right">&nbsp;</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right" valign="middle">* Adresse e-mail :</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td><input name="txtemail2" type="text" class="text" id="txtemail2" value="" /> 
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right">&nbsp;</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right" valign="top" class="txtarea">* Votre message :</td>
                                                                <td width="20">&nbsp;</td>
                                                                <td rowspan="2" valign="top"><textarea name="txtmsg" class="text" id="txtmsg"></textarea></td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right">&nbsp;</td>
                                                                <td width="20">&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                                <td><input name="txtcivilite7" type="submit" class="button" id="txtcivilite7" value="Envoyer" size="45" onfocus="this.blur();"/></td>
                                                            </tr>
                                                        </table>
                                                    </form>

                                                    <div class="bn-c-right">
                                                        <div class="bn-c-right-reseig">RENSEIGNEMENTS:</div>
                                                        <?php
                                                        $SQL = "SELECT 
                              `int_id_contacts`,
                              `int_id_sections_view`,
                              `var_cont_nom`,
                              `var_cont_status`,
                              `var_cont_tel`,
                              `var_cont_email`,
                              `int_id_state`
                            FROM 
                              `tbl_contacts`
                            WHERE `int_id_sections_view` = '" . $row['int_id_sections_view'] . "' AND `int_id_state` <> 3";

                                                        $res5 = mysql_query($SQL, $cnn);
                                                        $tt = mysql_num_rows($res5);
                                                        $ii = 1;
                                                        while ($row5 = mysql_fetch_assoc($res5)) {
                                                            ?><strong><?php echo $row5['var_cont_nom']; ?></strong><br />
                                                            <em><?php echo $row5['var_cont_status']; ?></em><br />
                                                            Tel. <?php echo $row5['var_cont_tel']; ?><br />
                                                            <a href="mailto:<?php echo $row5['var_cont_email']; ?>"><?php echo $row5['var_cont_email']; ?></a><br /><br />
                                                            <?php if ($ii < $tt) { ?>
                                                                <div class="bn-line"></div>
                                                                <?php
                                                            }
                                                            $ii++;
                                                        }
                                                        ?>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="panel">
                                                <div class="panel-wrapper">
                                                    <h2 class="title" id="m-acess">Accès <div class="sub-line title"></div></h2>


                                                    <!--GOOGLE MAP -->
                                                    <table class="ct-googlemap" width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td>
                                                                <div id="map" class="section-map"></div>
                                                            </td>
                                                            <td valign="top">

                                                                <?php
                                                                $SQL = "SELECT 
                                                                  `int_id_sections_ubicacion`,
                                                                  `txt_ubicacion`,
                                                                  `int_id_section`
                                                                FROM 
                                                                  `tbl_sections_ubicacion`
                                                                WHERE `int_id_section` = '" . $newId . "' ";

                                                                $ress = mysql_query($SQL, $cnn);
                                                                $l = 1;
//                                                                $a = 0;
                                                                $i = mysql_num_rows($ress);
                                                                while ($rows = mysql_fetch_assoc($ress)) {
                                                                    ?>
                                                                    <a id="map-<?php echo $l; ?>" class="click map <?php if ($i == $l && $i > 1): ?>last<?php endif; ?>">
                                                                        <img src="markers/image03.png" width="36" height="53" /><br />                                                                <?php
//                                                            $a++;
                                                            if ($SECCION == "Tennis") {
                                                                if ($l == 1) {
                                                                    echo "<strong>";
                                                                    echo "Badminton";
                                                                    echo "</strong><br />";
                                                                } else {
                                                                    echo "<strong>";
                                                                    echo $SECCION;
                                                                    echo "</strong><br />";
                                                                }
                                                            } else {
                                                                echo "<strong>";
                                                                echo $SECCION;
                                                                echo "</strong><br />";
                                                            }
                                                            echo $rows['txt_ubicacion'];
                                                                    ?> 
                                                                    </a>
                                                                    <?php
//                                                                    if ($i > 1 && $i > $l) {
                                                                    ?>
                                                                    <div class="sub-line map"></div>
                                                                    <?php
//                                                                    }
                                                                    $l++;
                                                                }
                                                                ?>

                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <!-- END GOOGLE MAP -->


                                                </div>
                                            </div>

                                            <div class="panel">
                                                <div class="panel-wrapper">
                                                    <h2 class="title" id="m-liens">Liens <div class="sub-line title"></div></h2>
                                                    <?php
                                                    $SQL = "SELECT 
                                                      var_lien_title,
                                                      var_lin_link,
                                                      int_id_state
                                                    FROM
                                                      tbl_liens
                                                    WHERE `int_id_sections_view` = '" . $row['int_id_sections_view'] . "' AND `int_id_state` <> 3";

                                                    $res6 = mysql_query($SQL, $cnn);
                                                    $tt = mysql_num_rows($res6);
                                                    $ii = 1;
                                                    while ($row6 = mysql_fetch_assoc($res6)) {
                                                        ?>
                                                        <a class="lien" href="<?php echo $row6['var_lin_link']; ?>" target="_blank">
                                                            <p class="sub-lien"><strong><?php echo $row6['var_lien_title']; ?></strong></p>

                                                            <p><?php echo $row6['var_lin_link']; ?></p>
                                                            <?php if ($ii < $tt) { ?>
                                                                <div class="sub-line2 lien"></div></a>
                                                            <?php
                                                        }
                                                    }
                                                    ?>
                                                </div>
                                            </div>

                                        </div>
                                    <?php } ?>
                                </div>          
                            </td>
                        </tr>
                    </table>
                    <div class="fldbtm"></div>
                </div>
                <!-- END CONTENT TEXT -->

                <div id="push"></div>

            </div>
            <!-- BN-CONTENT-->

        </div>

        <?php
        include 'modules/footer.html.php';
        printFooter($cnn, $select);
        printTooltips($cnn);
        ?>

        <script type="text/javascript">var _section='<?php echo $SECCION; ?>',_num_galleries=<?php echo $num_galleries; ?>;</script>
        <script type="text/javascript" src="js/js-main.js"></script>
        <script type="text/javascript" src="js/slider-les-sections.js"></script>
        <script type="text/javascript" src="js/<?php echo $FILE_MAP; ?>"></script>
        <script type="text/javascript" src="js/js-contact.js"></script>
        <script type="text/javascript" src="js/js-section-map.js"></script>

        <?php printAutoScrollSection($ip); ?>
        <?php
        printMyVisites();
        @mysql_close();
        ?>
    </body>
</html>